"""apps URL Configuration

The `urlpatterns` list routes URLs to views. For more information please see:
    https://docs.djangoproject.com/en/3.1/topics/http/urls/
Examples:
Function views
    1. Add an import:  from my_app import views
    2. Add a URL to urlpatterns:  path('', views.home, name='home')
Class-based views
    1. Add an import:  from other_app.views import Home
    2. Add a URL to urlpatterns:  path('', Home.as_view(), name='home')
Including another URLconf
    1. Import the include() function: from django.urls import include, path
    2. Add a URL to urlpatterns:  path('blog/', include('blog.urls'))
"""
from django.contrib import admin
from django.urls import path
# gunicron 支持静态文件
from django.contrib.staticfiles.urls import staticfiles_urlpatterns

# 载入应用
from .example import views as example_views
from .index import views as index_views

urlpatterns = [
    path('', index_views.homepage),
    path('admin/', admin.site.urls),

    # 各种库使用的案例
    path('index', example_views.index), #使用第三方数据库
    path('testcache', example_views.testcache), #使用 django 缓存
]

# 增加debug-toolbar 支持支持
from django.conf import settings
if settings.DEBUG:
    from django.conf.urls import include, url
    import debug_toolbar
    urlpatterns = [
        url(r'^__debug__/', include(debug_toolbar.urls)),
    ] + urlpatterns

# gunicorn 增加静态文件的支持 (使用请查看 settings.py collectstatic)
urlpatterns += staticfiles_urlpatterns()